import request from "@/utils/request";
import { getParamsSuffix } from "@/utils/paramsUtils";


/**
 * 分页
 * @param params
 * @returns {Promise<any>}
 */
export async function listAllData(params) {
    return request('/api/cdcerservice/v1/treatment/listAllData', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}


/**
* 详情
* @param query
* @returns {Promise<any>}
*/
export async function findById(query) {
    const params = getParamsSuffix(query);
    return request(`/api/cdcerservice/v1/treatment/findById?${params}`);
}

/**
* 字典
* @param query
* @returns {Promise<any>}
*/
export async function findAllDictName(query) {
    const params = getParamsSuffix(query);
    return request(`/api/cdcerservice/v1/sysDict/findAllDictName?${params}`);
}

/**
* 当前机构下的人
* @param query
* @returns {Promise<any>}
*/
export async function getUserByOrgId(query) {
    const params = getParamsSuffix(query);
    return request(`/api/admin/sysuser/getUserByOrgId?${params}`);
}

/**
 * 编辑保存
 * @param params
 * @returns {Promise<any>}
 */
export async function update(params) {
    return request('/api/cdcerservice/v1/treatment/update', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}

/**
 * 存入正式库
 * @param params
 * @returns {Promise<any>}
 */
export async function insertOfficeInfo(params) {
    return request('/api/cdcerservice/v1/treatmentOffical/insertOfficeInfo', {
        method: 'POST',
        requestType: 'form',
        data: { ...params },
    });
}


/**
 * 点击导出所有信息
 * @returns {Promise<any>}
 * @param params
 */
export async function exportData(params) {
    return request(`/api/cdcerservice/v1/treatment/exportData`, {
      method: 'POST',
      requestType: 'form',
      responseType: 'blob',
      data: {
        ...params
      }
    });
  }
  